<template>
  <div class="app-container">
    <el-card shadow="never">
      <el-form :model="form" label-width="auto" style="max-width: 600px">
        <el-form-item label="創建訪客的會員數量">
          <el-input v-model="form.totalCustomers" />
        </el-form-item>
        <el-form-item label="每位會員名下的訪客數量">
          <el-input v-model="form.totalVisitors" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" :loading="loading" @click="onSubmit">創建</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import { useI18n } from "vue-i18n";
import { ref } from "vue";
defineOptions({
  name: "Customer",
  inheritAttrs: false,
});

const { t } = useI18n();

import MockAPI from "@/api/mock";
const loading = ref(false);

const form: any = reactive<any>({
  totalCustomers: 10,
  totalVisitors: 20,
});

function onSubmit() {
  loading.value = true;
  MockAPI.makeVisitor(form)
    .then((data) => {
      ElMessage.info(data.data["message"]);
    })
    .finally(() => {
      loading.value = false;
    });
}
</script>

<style scoped>
.scrollbar-demo-item {
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
}
</style>
